# -*- coding: utf-8 -*-
"""
# --------------------------------------------------------
# @Author : Pan
# @E-mail : 
# @Date   : 2025-11-03 15:28:15
# @Brief  :
# --------------------------------------------------------
"""
import os
import base64
from pybaseutils import http_utils, json_utils, image_utils, base64_utils

url = "http://192.168.68.102:40000/v1/chat/completions"
from app.config import config

image_file = os.path.join(config.root, "data/image1.jpg")
video_file = os.path.join(config.root, "data/video2.mp4")
image = image_utils.read_image(image_file, use_rgb=True)
params = {"model": "qwen3-vl-2b-instruct",
          "messages": [{"role": "user",
                        "content": [{"type": "text", "text": "你好，请介绍一下自己"}],
                        },
                       {"role": "user",
                        "content": [{"type": "image", "image": image},
                                    {"type": "text", "text": "请描述这张图片"}
                                    ],
                        }],
          "configs": {},
          "reqid": "123456789"}
params = base64_utils.serialization(params, prefix="data:image/jpeg;base64,", use_rgb=True)
result = http_utils.post(url, params=params)
print(json_utils.formatting(result))
